/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.quickorm.sample.daoimpl;

import com.quickorm.sample.dao.UserDao;
import com.quickorm.sample.daoimpl.support.BaseDaoImpl;
import com.quickorm.sample.entity.User;
import java.util.List;

/**
 *
 * @author aaa
 */
public class UserDaoImpl extends BaseDaoImpl implements UserDao {

    @Override
    public List<User> getUserListWithRole() {
        String sql = "SELECT a.*,b.RoleId AS Role_RoleId,b.Name AS Role_Name FROM User AS a,UserRole AS b WHERE a.RoleId = b.RoleId";
        return super.getQuickormTemplate().executeQuery(sql, User.class);
    }

    @Override
    public void deleteUserByLoginName(String loginName) {
        String sql = "DELETE FROM User WHERE LoginName = ?";
        super.getQuickormTemplate().executeUpdate(sql, loginName);
    }
}
